/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package poo.biblioteca.vistas.editoriales;

import biblioteca.entidades.Pais;
import java.awt.event.ActionListener;
import javax.swing.JOptionPane;

/**
 *
 * @author Alex
 */
public class DlgModificarEditoriales extends javax.swing.JDialog {

    /**
     * Creates new form DlgModificarEditoriales
     */
    public DlgModificarEditoriales(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        pnlEditorial = new poo.biblioteca.vistas.editoriales.PnlEditorial();
        btnOk = new javax.swing.JButton();
        btnCancelar = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Modificar Editorial");

        btnOk.setMnemonic('O');
        btnOk.setText("Ok");

        btnCancelar.setMnemonic('C');
        btnCancelar.setText("Cancelar");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(pnlEditorial, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(btnCancelar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnOk, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pnlEditorial, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnOk)
                    .addComponent(btnCancelar))
                .addContainerGap(35, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnCancelar;
    private javax.swing.JButton btnOk;
    private poo.biblioteca.vistas.editoriales.PnlEditorial pnlEditorial;
    // End of variables declaration//GEN-END:variables

    public void setIdEditorial(int idEditorial) {
        pnlEditorial.setIdEditorial(Integer.toString(idEditorial));
    }

    public void btnCancelarAddActionListener(ActionListener actionListener) {
        btnCancelar.addActionListener(actionListener);
    }

    public void btnOkAddActionListener(ActionListener actionListener) {
        btnOk.addActionListener(actionListener);
    }

    public String getNombreEditorial() {
        return pnlEditorial.getNombreEditorial();
    }
    
    
    public PnlEditorial getPanel() {
        return pnlEditorial;
    }

    public void setPaisSeleccionado(Pais pais) {
        pnlEditorial.setPaisSeleccionado(pais);
    }

    public Pais getPais() {
       return pnlEditorial.getPaisSeleccionado();
    }

    public void mostrarMensajeError(String message, String error_de_Aplicación) {
        JOptionPane.showMessageDialog(this, message, "Error de Aplicación", 
                JOptionPane.ERROR_MESSAGE);
    }

    public void setNombreEditorial(String nombreEditorial) {
        pnlEditorial.setNombreEditorial(nombreEditorial);
    }
}
